<template>
  <div class="app-container">

    <!-- 搜索工具栏 -->
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
      <el-row :gutter="10" class="mb8">
        <el-radio-group v-model="queryParams.state" size="small" @change="handleQuery">
          <el-radio-button
            v-for="dict in stateOptions"
            :key="dict.dictValue"
            :label="dict.dictValue"
            :value="dict.dictValue"
          >{{dict.dictLabel}}</el-radio-button>
          <el-radio-button label="">全部</el-radio-button>
        </el-radio-group>
        <el-divider></el-divider>
      </el-row>
      <el-form-item label="资讯ID" prop="title">
        <el-input
          v-model="queryParams.id"
          placeholder="请输入资讯ID"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="资讯分类" prop="type">
        <el-select v-model="queryParams.type" placeholder="请选择资讯分类" clearable size="small" style="width: 120px">
          <el-option
            v-for="dict in typeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="类型" prop="kind" v-if="false">
        <el-select v-model="queryParams.kind" placeholder="请选择赛事类型" clearable size="small" style="width: 120px">
          <el-option
            v-for="dict in kindOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="资讯标题" prop="title">
        <el-input
          v-model="queryParams.title"
          placeholder="请输入资讯标题"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="time" v-if="false">
        <el-date-picker clearable
                        v-model="queryParams.time"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="daterangecreatetime"
          size="small"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 功能按钮 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['business:news:add']"
          v-show="handleAddShow"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['business:news:edit']"
          v-show="handleUpdateShow"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-upload"
          size="mini"
          :disabled="multiple"
          @click="handleSubmit"
          v-hasPermi="['business:news:submit']"
          v-show="handleSubmitShow"
        >提交</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['business:news:remove']"
          v-show="handleDeleteShow"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['business:news:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="newsList" @selection-change="handleSelectionChange" :header-cell-style="{'text-align':'center'}">
      <el-table-column type="selection" width="50" align="center" />
      <el-table-column
        label="序号"
        type="index"
        min-width="20%"
        align="center">
        <template slot-scope="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="资讯ID" align="center" prop="id" min-width="50%"/>
      <el-table-column label="资讯分类" align="center" prop="type" min-width="65%">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.news_type" :value="scope.row.type"/>
        </template>
      </el-table-column>
      <el-table-column label="赛事类型" align="center" prop="kind" v-if="false">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.competition_type" :value="scope.row.kind"/>
        </template>
      </el-table-column>
      <el-table-column label="资讯标题" align="center" prop="title"  min-width="180%"/>
      <el-table-column label="图片" align="center" prop="photo" min-width="70%">
        <template slot-scope="scope">
          <image-preview :src="scope.row.photo" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="作者" align="center" prop="writer" v-if="false"/>
      <el-table-column label="发布时间" align="center" prop="time" width="180" v-if="false">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.time, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="简介" align="center" prop="introduce" v-if="false"/>
      <el-table-column label="附件" align="center" prop="file" v-if="false"/>
      <el-table-column label="联系人" align="center" prop="contact" v-if="false"/>
      <el-table-column label="联系电话" align="center" prop="phone" v-if="false"/>
      <el-table-column label="创建人" align="center" prop="createby" v-if="false"/>
      <el-table-column label="创建时间" align="center" prop="createtime" min-width="85%">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createtime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="updatetime" min-width="85%">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updatetime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" prop="state" min-width="65%">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.news_state" :value="scope.row.state"/>
        </template>
      </el-table-column>
      <el-table-column label="排序" align="center" prop="showorder" min-width="45%"/>
      <el-table-column label="操作" align="center" class-name="small-padding" min-width="100%">
        <template slot-scope="scope">
          <el-link
            :href="'http://i.gdsme.org/index/newspre?id='+scope.row.id"
            style="color: #1ab394;font-size: 10px"
            icon="el-icon-view"
            target="_blank"
            v-if="scope.row.state == 'initial' || scope.row.state == 'approvalback'">预览效果</el-link>
          <el-link
            :href="'http://i.gdsme.org/index/news?id='+scope.row.id"
            style="color: #1ab394;font-size: 10px"
            icon="el-icon-view"
            target="_blank"
            v-if="scope.row.state == 'approval'">前往正式网页</el-link>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleShow(scope.row)"
            v-hasPermi="['business:news:query']"
          >查看</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['business:news:edit']"
            v-show="scope.row.state == 'initial' || scope.row.state == 'approvalback'"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-upload"
            @click="handleSubmit(scope.row)"
            v-hasPermi="['business:news:submit']"
            v-show="scope.row.state == 'initial' || scope.row.state == 'approvalback'"
          >发布</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['business:news:remove']"
            v-show="scope.row.state == 'initial' || scope.row.state == 'approvalback'"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleApprovalBack(scope.row)"
            v-hasPermi="['business:news:back']"
            v-show="scope.row.state == 'approval'"
          >撤回</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 翻页控件 -->
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改资讯对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1300px" append-to-body>
      <el-row :gutter="15">
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
          <el-col :span="8">
            <el-row gutter="15">
              <el-form-item label="资讯ID" prop="id" v-show="false">
                <el-input v-model="form.id" placeholder="请输入资讯ID" />
              </el-form-item>
              <el-form-item label="资讯分类" prop="type">
                <el-select v-model="form.type" placeholder="请选择资讯分类">
                  <el-option
                    v-for="dict in typeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="资讯标题" prop="title">
                <el-input v-model="form.title" type="textarea" placeholder="请输入资讯标题" />
              </el-form-item>
              <el-form-item label="作者" prop="writer">
                <el-input v-model="form.writer" placeholder="请输入作者" />
              </el-form-item>
              <el-form-item label="发布时间" prop="time" v-if="false">
                <el-date-picker clearable size="small"
                                v-model="form.time"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="选择发布时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="简介" prop="introduce">
                <el-input v-model="form.introduce" type="textarea" placeholder="请输入内容简介，50字以上，500字以下" />
              </el-form-item>
              <el-form-item label="封面图" prop="Photo" v-if="false">
                <imageUpload v-model="form.Photo"/>
              </el-form-item>
              <el-form-item label="附件" prop="file">
                <fileUpload v-model="form.file" @sendFileOriginalName="getFileOriginalName"/>
              </el-form-item>
              <el-form-item label="附件文件展示名" prop="fileTitle" v-if="false">
                <el-input v-model="form.fileTitle" type="textarea" placeholder="上传附件后自动填写，不用手动填写" />
              </el-form-item>
              <el-form-item label="联系人" prop="contact">
                <el-input v-model="form.contact" placeholder="请输入联系人" />
              </el-form-item>
              <el-form-item label="联系电话" prop="phone">
                <el-input v-model="form.phone" placeholder="请输入联系电话" />
              </el-form-item>
              <el-form-item label="备注" prop="remark">
                <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
              </el-form-item>
            </el-row>
          </el-col>
          <el-col :span="16">
            <el-row gutter="15">
              <el-form-item label="正文" prop="intro">
                <editor v-model="form.intro" :min-height="600"/>
              </el-form-item>
            </el-row>
          </el-col>
        </el-form>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 查看或审阅资讯对话框 -->
    <el-dialog :title="title" :visible.sync="showopen" width="1300px" append-to-body>
      <el-row :gutter="15">
        <el-form ref="form" :model="showForm" label-width="120px">
          <el-col :span="8">
            <el-row gutter="15">
              <el-form-item label="资讯ID" prop="id" v-show="false">
                <el-input v-model="showForm.id" placeholder="请输入资讯ID" readonly/>
              </el-form-item>
              <el-form-item label="资讯分类" prop="type">
                <el-select v-model="showForm.type" placeholder="请选择资讯分类" disabled>
                  <el-option
                    v-for="dict in typeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="资讯标题" prop="title">
                <el-input v-model="showForm.title" type="textarea" placeholder="请输入资讯标题" readonly/>
              </el-form-item>
              <el-form-item label="作者" prop="writer">
                <el-input v-model="showForm.writer" placeholder="请输入作者" readonly/>
              </el-form-item>
              <el-form-item label="发布时间" prop="time" v-if="false">
                <el-date-picker clearable size="small"
                                v-model="showForm.time"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="选择发布时间"
                                disabled>
                </el-date-picker>
              </el-form-item>
              <el-form-item label="简介" prop="introduce">
                <el-input v-model="showForm.introduce" type="textarea" placeholder="请输入内容" readonly/>
              </el-form-item>
              <el-form-item label="封面图" prop="Photo" v-if="false">
                <imageUpload v-model="showForm.Photo" readonly/>
              </el-form-item>
              <el-form-item label="附件" prop="file">
                <fileUpload v-model="showForm.file" readonly/>
              </el-form-item>
              <el-form-item label="附件文件展示名" prop="fileTitle" v-if="false">
                <el-input v-model="showForm.fileTitle" type="textarea" placeholder="上传附件后自动填写，不用手动填写" readonly/>
              </el-form-item>
              <el-form-item label="联系人" prop="contact">
                <el-input v-model="showForm.contact" placeholder="请输入联系人" readonly/>
              </el-form-item>
              <el-form-item label="联系电话" prop="phone">
                <el-input v-model="showForm.phone" placeholder="请输入联系电话" readonly/>
              </el-form-item>
              <el-form-item label="备注" prop="remark">
                <el-input v-model="showForm.remark" type="textarea" placeholder="请输入备注" readonly/>
              </el-form-item>
            </el-row>
          </el-col>
          <el-col :span="16">
            <el-row gutter="15">
              <el-form-item label="正文" prop="intro">
                <editor v-model="showForm.intro" :min-height="600" readonly/>
              </el-form-item>
            </el-row>
          </el-col>
        </el-form>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handlePass" id="passButton" v-show="passButtonShow" v-if="false">通过</el-button>
        <el-button type="danger" @click="handleBack" id="backButton" v-show="backButtonShow">资讯撤回</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import { listNews, getNews, submitNews, delNews, addNews, updateNews, exportNews, passNews, backNews } from "@/api/business/news";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getUserProfile} from "@/api/system/user";

export default {
  name: "News",
  dicts: ['news_type', 'news_state', 'competition_type'],
  components: {
    Treeselect
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 列表状态
      listState: "",
      // 总条数
      total: 0,
      // 资讯表格数据
      newsList: [],
      // 弹出层标题
      title: "",
      // 列表页面的功能按钮是否显示的变量
      handleAddShow: true,
      handleUpdateShow: true,
      handleDeleteShow: true,
      handleSubmitShow: true,
      handleApprovalShow: true,
      handleApprovalBackShow: true,
      // 审核对话框的审核、反审核按钮是否显示变量
      passButtonShow: true,
      backButtonShow: true,
      // 是否显示新增或修改资讯信息的弹出层
      open: false,
      // 是否显示新增或修改资讯信息的弹出层
      showopen: false,
      // 赛事类别字典
      kindOptions: [],
      // 资讯分类字典
      typeOptions: [],
      // 发布时间时间范围
      daterangetime: [],
      // 创建时间时间范围
      daterangecreatetime: [],
      // 状态字典
      stateOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: null,
        type: null,
        title: null,
        time: null,
        createtime: null,
        state: null,
        kind: null,
      },
      // 表单参数
      form: {},
      // 查看表单参数
      showForm: {},
      // 表单校验
      rules:  {
        type: [
          { required: true, message: "资讯分类不能为空", trigger: "change" }
        ],
        title: [
          { required: true, message: "资讯标题不能为空", trigger: "blur" }
        ],
        intro: [
          { required: true, message: "正文不能为空", trigger: "blur" }
        ],
        introduce: [
          { required: true, message: "简介不能为空", trigger: "blur" }
        ],
      },
      user: {
        userType: null,
      },
    };
  },
  created() {
    this.getList();
    this.getDicts("competition_type").then(response => {
      this.kindOptions = response.data;
    });
    this.getDicts("news_type").then(response => {
      this.typeOptions = response.data;
    });
    this.getDicts("news_state").then(response => {
      this.stateOptions = response.data;
    });
    // 获取当前用户对象
    this.getUser();
  },
  methods: {
    /** 选择了报名赛事，同步报名赛事信息和当前赛事信息 - 因为一般创建时，当前所在的赛事即报名的赛事 */
    DRHA_EFaultModeTree_handleSelect(node,instanceId) {

    },
    /** 获取当前用户信息 */
    getUser() {
      getUserProfile().then(response => {
        this.user = response.data;
      });
    },
    /** 查询资讯列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangetime && '' != this.daterangetime) {
        this.queryParams.params["begintime"] = this.daterangetime[0];
        this.queryParams.params["endtime"] = this.daterangetime[1];
      }
      if (null != this.daterangecreatetime && '' != this.daterangecreatetime) {
        this.queryParams.params["begincreatetime"] = this.daterangecreatetime[0];
        this.queryParams.params["endcreatetime"] = this.daterangecreatetime[1];
      }
      const listState = this.queryParams.state;
      listNews(this.queryParams).then(response => {
        // 列表中每一行的按钮是否显示的变量
        this.handleAddShow = false;
        this.handleUpdateShow = false;
        this.handleDeleteShow = false;
        this.handleSubmitShow = false;
        this.handleApprovalShow = false;
        this.handleApprovalBackShow = false;

        if(listState == null || listState == "")
        {
          this.queryParams.state = "";
          this.handleAddShow = true;
          this.handleUpdateShow = true;
          this.handleDeleteShow = true;
        } else if(listState == "initial")
        {
          this.handleAddShow = true;
          this.handleUpdateShow = true;
          this.handleDeleteShow = true;
          this.handleSubmitShow = true;
        } else if(listState == "approvalback")
        {
          this.handleUpdateShow = true;
          this.handleDeleteShow = true;
          this.handleSubmitShow = true;
        } else if(listState == "approval")
        {
          this.handleApprovalBackShow = true;
        } else if(listState == "definite")
        {
          this.handleApprovalBackShow = true;
        }

        this.newsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 资讯分类字典翻译
    typeFormat(row, column) {
      return this.selectDictLabel(this.typeOptions, row.type);
    },
    // 状态字典翻译
    stateFormat(row, column) {
      return this.selectDictLabel(this.stateOptions, row.state);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.showopen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        type: null,
        title: null,
        writer: null,
        time: null,
        introduce: null,
        intro: null,
        Photo: null,
        file: null,
        fileTitle: null,
        contact: null,
        phone: null,
        remark: null,
        createid: null,
        createtime: null,
        state: null,
        newsUpdateId: null,
        newsUpdateTime: null,
        newsApproveId: null,
        newsApproveTime: null
      };
      this.showForm = {
        id: null,
        type: null,
        title: null,
        writer: null,
        time: null,
        introduce: null,
        intro: null,
        Photo: null,
        file: null,
        fileTitle: null,
        contact: null,
        phone: null,
        remark: null,
        createid: null,
        createtime: null,
        state: null,
        newsUpdateId: null,
        newsUpdateTime: null,
        newsApproveId: null,
        newsApproveTime: null
      };
      this.resetForm("form");
      this.resetForm("showForm");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangetime = [];
      this.daterangecreatetime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加资讯";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getNews(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改资讯";
      });
    },
    /** 查看按钮操作 */
    handleShow(row) {
      this.reset();
      const id = row.id || this.ids
      getNews(id).then(response => {
        this.showForm = response.data;
        this.showopen = true;
        this.title = "查看资讯";
        this.passButtonShow = false;
        this.backButtonShow = false;
      });
    },
    /** 进入对话框按钮操作 */
    handleApproval: function (row) {
      this.reset();
      const id = row.id || this.ids
      getNews(id).then(response => {
        this.showForm = response.data;
        this.showopen = true;
        this.title = "资讯";
        this.passButtonShow = true;
        this.backButtonShow = true;
      });
    },
    /** 进入反对话框按钮操作 */
    handleApprovalBack: function (row) {
      this.reset();
      const id = row.id || this.ids
      getNews(id).then(response => {
        this.showForm = response.data;
        this.showopen = true;
        this.title = "资讯撤回";
        this.passButtonShow = false;
        this.backButtonShow = true;
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateNews(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addNews(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 提交供按钮操作 */
    handleSubmit(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认将资讯编号为"' + ids + '"的数据项提交?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "info"
      }).then(function() {
        return submitNews(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("发布成功");
      }).catch(() => {});
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除资讯编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return delNews(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有资讯数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.exportLoading = true;
        return exportNews(queryParams);
      }).then(response => {
        this.download(response.msg);
        this.exportLoading = false;
      }).catch(() => {});
    },
    /** 通过按钮 */
    handlePass() {
      const ids = this.showForm.id || this.ids;
      this.$confirm('是否确认审核通过资讯编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        passNews(ids).then(response => {
          this.$modal.msgSuccess("通过成功");
          this.showopen = false;
          this.getList();
        });
      }).then(response => {
      }).catch(() => {});
    },
    /** 反退回按钮 */
    handleBack() {
      const ids = this.showForm.id || this.ids;
      this.$confirm('是否确认反退回资讯编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        backNews(ids).then(response => {
          this.$modal.msgSuccess("反退回成功");
          this.showopen = false;
          this.getList();
        });
      }).then(response => {
      }).catch(() => {});
    },
    getFileOriginalName(fileOriginalName) {
      this.form.fileTitle = fileOriginalName;
      console.log("接收到的表单中流向数据文件原名称："+fileOriginalName);
    }
  }
};
</script>
